fix: CSVImport bugs (AUTH column, case-insensitive validation, username case) + QuerysetEndpoint.find_by_name - #1811
Open
jacalata wants to merge 4 commits into
Open
Conversation
2 tasks
…servation; add find_by_name Fixes for UserItem.CSVImport (issue #1809): - MAX=8 (was 7=AUTH index): 8-column lines with auth type no longer rejected as "too many columns" - create_user_from_line no longer lowercases the whole line before splitting — username case is preserved - _validate_import_line_or_throw normalizes license/admin/publisher to lowercase and auth to canonical form before comparison, so 'Viewer', 'Creator', 'SAML', 'tableauidwithmfa' etc. are all accepted - Add TableauIDWithMFA to valid auth values in validation (was missing) - 5 new tests covering each fix Add QuerysetEndpoint.find_by_name(name) (issue #1810): - Thin wrapper over .filter(name=name) returning a list - Available on all content-item endpoints (workbooks, datasources, views, users, projects, groups) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jacalata
force-pushed
the
jac/csv-import-fixes-and-find-by-name
branch
from
July 28, 2026 01:01
d3376c9 to
948e382
Compare
2 tasks
…rty setter Two related fixes so unmapped auth values fail loudly at CSV parse time rather than producing a UserItem with silently missing auth_setting: - create_user_from_line: raise ValueError instead of silently setting auth to None when the AUTH column value isn't in _auth_canonical(). - _set_values: route auth_setting through the @property_is_enum(Auth) setter rather than writing to _auth_setting directly, so any invalid auth string is rejected at assignment. These two together close bug #5 in #1809 (setter bypass) and the silent- None finding surfaced in an adversarial review of the earlier commits on this branch. Callers who want lenient behavior (skip invalid rows, keep going) can catch the exception in their own iteration loop — that's the model tabcmd uses today via its --complete/--no-complete flag. Once this lands, tabcmd can defer its per-line validation to TSC (see #1809 and #1836). Also tightens test_too_many_columns_raises to expect ValueError only (was accepting either ValueError or AttributeError).
find_by_name was bundled with the CSVImport fixes in earlier commits because it landed in the same working commit. It's orthogonal to the CSV work and closes a different issue (#1810), so it belongs in its own PR. Reverting the 3-line addition here; will land as a separate branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all bugs in
UserItem.CSVImporttracked in #1809, so tabcmd can eventually defer its per-line validation to TSC (see #1836 for the follow-on file-import method).CSVImport fixes
Bug 1 — AUTH column unreachable (off-by-one on
MAX)ColumnType.AUTH = 7andColumnType.MAX = 7were equal, so any 8-column line was rejected as "too many columns".MAXis now8(number of columns, not last index).Bug 2 —
create_user_from_linelowercased the whole line including usernamesline.strip().lower()ran before splitting, destroying case for LDAP/mixed-case usernames. Now only the comparison-relevant fields (license, admin, publisher, auth) are normalized.Bug 3 —
TableauIDWithMFAmissing from validation allowlist_valid_attributesfor the auth column omittedTableauIDWithMFA, causing valid CSVs to be rejected.Bug 4 — Case-sensitive validation rejected valid mixed-case values
_validate_attribute_valuecompared raw input against lowercase allowlists, soViewer,Creator,SAMLetc. were all rejected. Validation now normalizes each field's value to lowercase (or canonical form for auth) before comparison.Bug 5 —
_set_valuesbypassed the@property_is_enumguard onauth_setting_set_valueswrote directly toself._auth_setting, so a CSV-parsedUserItemcould carry an invalidauth_settingthat only failed at the API call. Routed through the property setter now, so invalid values raise at assignment.Bug 6 — Unknown AUTH values silently set
auth_setting=Nonecreate_user_from_lineused_auth_canonical().get(...)which returnedNonefor anything not in the mapping. Now raisesValueErroron unknown AUTH values so bad input can't slip through unnoticed. Callers who want lenient behavior can catch the exception.Closes #1809
🤖 Generated with Claude Code